using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
namespace PFDB.AppLib.MYSQLSET
{

	/// <summary>
	/// 
	/// </summary>
    class DBConnect
    {
        #region connectionString
        public static string connString(string server, string database, string username, string password)
        {
            return "server=" + server + "; uid=" + username + "; pwd=" + password + ";database=" + database + ";";
        }
        public static string connString(string database, string username, string password)
        {
            return "server=localhost; uid=" + username + "; pwd=" + password + ";database=" + database + ";";
        }

        #endregion

        #region connection

		/// <summary>
		/// Connection the specified database.
		/// </summary>
		/// <param name="database">The database.</param>
		/// <param name="username">The username.</param>
		/// <param name="password">The password.</param>
		/// <param name="server">The server.</param>
		/// <returns></returns>
        public static MySqlConnection conn(string database, string username, string password, string server)
        {
            return new MySqlConnection(connString(server,database,username,password));
        }
		/// <summary>
		/// Connection for this instance.
		/// </summary>
		/// <returns></returns>
        public static MySqlConnection conn()
        {
            return new MySqlConnection();
        }

        #endregion

        #region command

        public static MySqlCommand comm()
        {
            return new MySqlCommand();
        }
        public static MySqlCommand comm(string command)
        {
            return new MySqlCommand(command);
        }
        public static MySqlCommand comm(string command, MySqlConnection conn)
        {
            return new MySqlCommand(command, conn);
        }
        #endregion
    }
}
